//
//  HttpRequestOperation.h
//  httpCommon
//
//  Created by admin on 2017/8/10.
//  Copyright © 2017年 admin. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "HttpAPIConfig.h"
#import "HttpUploadFile.h"
#import "HttpRequest.h"
#import "HttpResponse.h"
/**
 网络请求失败

 @param url -
 @param code -
 @param msg -
 */
typedef void(^HttpRequestFaildBlock)(NSString* url,NSInteger code,NSString* msg);



@class HttpRequest;

@interface HttpRequestOperation : NSObject


/**
 网络请求失败回调 主要用户日志
 */
@property (class,nonatomic,copy)HttpRequestFaildBlock requestFiladBlock;

/**
 主机地址
 */
@property (class,nonatomic,copy,readonly)NSString* hostURL;

/**
 资源地址
 */
@property (class,nonatomic,copy,readonly)NSString* resourceURL;

/**
 设置请求头部信息
 
 @param requestHeader -
 */
+ (void)setRequestHeader:(NSDictionary<NSString*,NSString*> *)requestHeader;

/**
 *  通用：数据请求（请求数据为model）
 *  quite YES静态加载
 */
+ (void)request:(HttpRequest *)request quite:(BOOL)quite callBack:(HttpResponseBlock)callBack;


/**
 *  普通上传文件
 *  quite YES静态加载
 */
+ (void)upload:(HttpRequest*)request files:(NSArray<HttpUploadFile *> *)files quite:(BOOL)quite callBack:(HttpResponseBlock)callBack;

/**
 *  新地址普通文件上传
 */
+ (void)uploadFile:(HttpRequest*)request files:(NSArray<HttpUploadFile *> *)files quite:(BOOL)quite callBack:(HttpResponseBlock)callBack;

/**
 *  新地址文件安全上传
 */
+ (void)safeUpload:(HttpRequest*)request files:(NSArray<HttpUploadFile *> *)files quite:(BOOL)quite callBack:(HttpResponseBlock)callBack;

/**
 *  监听网络状态
 *  notReachable     yes:无网  no:有网
 */
+ (void)startMonitoringWithResult:(void(^)(BOOL invalid))block;

/**
 停止监听
 */
+ (void)stopMonitoring;


@end
